package br.org.group.android.dao;

import android.content.Context;
import br.org.group.android.app.FortuneProvider;
import br.org.group.android.app.FortuneVO;

/**
 * Created by IntelliJ IDEA. User: abner Date: 1/13/11 Time: 7:29 PM
 */
public class FortuneProviderDatabase implements FortuneProvider {

	private FortunesDbAdapter fDbAdapter;

	public FortuneProviderDatabase(Context context) {
		fDbAdapter = new FortunesDbAdapter(context);

	}

	public FortuneVO updateFortune() {
		FortuneVO fortune = new FortuneVO();
		FortunesDAO dt = fDbAdapter.retornaFortune();
		
		fortune.setMensagem(dt.getMensagem());
		fortune.setAutor(dt.getAutor());
		fortune.setId(dt.getId());
		
		return fortune;
	}

	public FortuneVO getFortune(int id){
		FortuneVO fortune = new FortuneVO();
		FortunesDAO dt = fDbAdapter.getFortune( id);
		
		fortune.setMensagem(dt.getMensagem());
		fortune.setAutor(dt.getAutor());
		fortune.setId(dt.getId());
		
		return fortune;
	}
}
